package com.gibbs.audio.webrtc;

public class AgcContext {
    private final AutomaticGainControlUtils proxy;
    private final long nativeContext;

    public AgcContext() {
        proxy = new AutomaticGainControlUtils();
        nativeContext = proxy.agcCreate();
    }

    public int init(int minLevel, int maxLevel, int agcMode, int fs) {
        return proxy.agcInit(nativeContext, minLevel, maxLevel, agcMode, fs);
    }

    public int config(short targetLevelDbfs, short compressionGaindB, boolean limiterEnable) {
        return proxy.agcSetConfig(nativeContext, targetLevelDbfs, compressionGaindB, limiterEnable);
    }

    public int process(short[] inNear, int num_bands, int samples, short[] out, int inMicLevel,
                       int outMicLevel, int echo, boolean saturationWarning) {
        return proxy.agcProcess(nativeContext, inNear, num_bands, samples, out, inMicLevel,
                outMicLevel, echo, saturationWarning);
    }

    public int release() {
        return proxy.agcFree(nativeContext);
    }
}
